package com.txunda.zhuohired.adapter.user.my;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.bean.user.my.CareerProgressBean;

import java.util.List;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/9 10:36
 * 功能描述：求职进展adapter
 * 联系方式：jiahuanchen@126.com
 */

public class CareerProgressAdapter extends BaseAdapter {
    private Context context;
    private ViewHolder holder;
    private List<CareerProgressBean.DataBean> careerList;
    public CareerProgressAdapter(Context context, List<CareerProgressBean.DataBean> careerList) {
        this.context = context;
        this.careerList = careerList;
    }

    @Override
    public int getCount() {
        return careerList.size();
    }

    @Override
    public Object getItem(int i) {
        return careerList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_career_progress, null);
            holder = new ViewHolder();
            view.setTag(holder);
            ViewUtils.inject(holder, view);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_job_name.setText(careerList.get(i).getTitle());
        holder.tv_create_time.setText(careerList.get(i).getTime());
        holder.tv_com_name.setText(careerList.get(i).getName());
        holder.tv_status.setText(careerList.get(i).getStatus_text());
        return view;
    }

    class ViewHolder {
        @ViewInject(R.id.tv_job_name)
        TextView tv_job_name;
        @ViewInject(R.id.tv_status)
        TextView tv_status;
        @ViewInject(R.id.tv_com_name)
        TextView tv_com_name;
        @ViewInject(R.id.tv_create_time)
        TextView tv_create_time;
    }
}
